package com.lry.order.service;

import com.lry.entity.order.Order;
import com.lry.rpc.netty.RpcContext;
import com.lry.rpc.starter.annotation.RpcService;
import com.lry.service.order.OrderService;
import lombok.extern.slf4j.Slf4j;

import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;

@RpcService()
@Slf4j
public class OrderServiceImpl implements OrderService {

    Map<Integer,Order> orderCache = new HashMap();
    {
        for(int i=1;i<10;i++){
            Order order = new Order(i,"orderSn"+i);
            orderCache.put(i,order);
        }
    }

    @Override
    public Order getById(Integer id) {
//        int i=1/0;
        log.info("context={}",RpcContext.getContext());
        return orderCache.get(id);
    }


}
